﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
using WeChat.PlatForm.Entity;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace WeChat.PlatForm.DataAccess.Configs
{
    public class PersonConfig : IEntityTypeConfiguration<PersonEntity>
    {
        public void Configure(EntityTypeBuilder<PersonEntity> builder)
        {
            //指定数据库中的表
            builder.ToTable("Person");

            //一对多
            builder.HasOne(a => a.School).WithMany().HasForeignKey(a => a.SchoolId);
        }
    }
}
